<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

if ( ! function_exists('ShowStyle'))
{
    function ShowStyle($files,$path)
    {
        $ci=& get_instance();
        $ci->load->helper('url');
        $basePath = base_url();
        $style = '';
        if(is_array($files)){
            foreach($files as $f){
                if(!is_string($f))continue;
                if(file_exists(FCPATH.$path.$f)){
                    $version = filemtime(FCPATH.$path.$f);
                    if(strpos($f,'-ie7')!==false){ $style .= "<!--[if IE 7]>\n"; }
                    if(strpos($f,'-noScript')!==false){ $style .= "<noscript>\n"; }
                    $style .= "\t<link rel='stylesheet' type='text/css' media='screen' href='{$basePath}{$path}{$f}?v={$version}'/>\n";
                    if(strpos($f,'-noScript')!==false){ $style .= "</noscript>\n"; }
                    if(strpos($f,'-ie7')!==false){ $style .= "<![endif]-->\n"; }
                }
                else{
                    $style .= "\t<!-- Files Not Found:  {$basePath}{$path}{$f}-->\n";
                }
            }
        }
        if(is_string($files)){
            if(file_exists(FCPATH.$path.$files)){
                $version = filemtime(FCPATH.$path.$files);
                $style = "\t<link rel='stylesheet' type='text/css' media='screen' href='{$basePath}{$path}{$files}?v={$version}'/>\n";
            }
            else{
                $style = "\t<!-- Files Not Found:  {$basePath}{$path}{$files}-->\n";
            }
        }
        return $style;
    }
}
if ( ! function_exists('ShowJavascript'))
{
    function ShowJavascript($files,$path)
    {
        $ci=& get_instance();
        $ci->load->helper('url');
        $basePath = base_url();
        $javascript = '';
        if(is_array($files)){
            foreach($files as $f){
                if(!is_string($f))continue;
                if(file_exists(FCPATH.$path.$f)){
                    $version = filemtime(FCPATH.$path.$f);
                    $javascript .= "\t<script type='text/javascript' src='{$basePath}{$path}{$f}?v={$version}'></script>\n";
                }
                else{
                    $javascript .= "\t<!-- Files Not Found:  {$basePath}{$path}{$f}-->\n";
                }
            }
        }
        if(is_string($files)){
            if(file_exists(FCPATH.$path.$files)){
                $version = filemtime(FCPATH.$path.$files);
                $javascript = "\t<script type='text/javascript' src='{$basePath}{$path}{$files}?v={$version}'></script>\n";

            }
            else{
                $javascript = "\t<!-- Files Not Found:  {$basePath}{$path}{$files}-->\n";
            }
        }
        return $javascript;
    }
}
